using UnityEngine;
using System.Collections;

/**
 * Script of FX play.
 * The purpose of this class is play sounds on collisions.
 * @author Benjamin Bruneau
 */
public class SoundScript : MonoBehaviour {
	
	private bool _isPlayed = false;
	
	/*
	 * Called on collision.
	 * @param Collision
	 * @return void
	 */
	void OnCollisionEnter(Collision pCollision)
	{
	
		// Play once
		if(!_isPlayed)
		{
			
			this.GetComponent<AudioSource>().Play();
			_isPlayed = true;
			
		}
			
	}
}
